﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Framework.Core;

namespace Framework
{
    /// <summary>
    /// 枚举的方法扩展
    /// </summary>
    public static class EnumExtensions
    {
        public static string GetCode(this OrgType orgType)
        {
            switch (orgType)
            {
                case OrgType.Headquarters:
                    return "01";
                case OrgType.Region:
                    return "02";
                case OrgType.Hotel:
                    return "03";
                default:
                    return null;
            }
        }

        public static OrgType FromCode(this OrgType orgType, string code)
        {
            switch (code)
            {
                case "01":
                    return OrgType.Headquarters;
                case "02":
                    return OrgType.Region;
                case "03":
                    return OrgType.Hotel;
                default:
                    throw new NotSupportedException();
            }
        }

        public static string GetCode(this HotelLevel hotelLevel)
        {
            switch (hotelLevel)
            {
                case HotelLevel.Quanji:
                    return "01";
                case HotelLevel.Hanting:
                    return "02";
                case HotelLevel.Haiyou:
                    return "03";
                case HotelLevel.Xingcheng:
                    return "04";
                case HotelLevel.Xiyue:
                    return "05";
                default:
                    return null;
            }
        }

        public static string GetCode(this HotelPropertyType propertyType)
        {
            switch (propertyType)
            {
                case HotelPropertyType.Direct:
                    return "01";
                case HotelPropertyType.Join:
                    return "02";
                default:
                    return null;
            }
        }

        public static string GetCode(this HotelBizScopeType scopeType)
        {
            switch (scopeType)
            {
                case HotelBizScopeType.Native:
                    return "01";
                case HotelBizScopeType.International:
                    return "02";
                default:
                    return null;
            }
        }
    }
}
